package com.zhss.ddd.lottery.draw.risk.control.api;

import lombok.Data;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * 风控算法实体的引用
 */
@Data
@Component
@Scope("prototype")
public class RiskControlAlgorithmRef implements IRiskControlAlgorithm{

    /**
     * 对风控算法实体的引用
     */
    @Reference(version = "1.0.0",
            interfaceClass = RiskControlApi.class,
            cluster = "failfast")
    private RiskControlApi riskControlService;
    /**
     * 用户Id
     */
    private Long userId;

    /**
     * 对用户进行风控拦截
     */
    public Boolean intercept() {
        return riskControlService.intercept(userId);
    }
}
